<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title>重置密码</title>
    <script src="js/mui.min.js"></script>
    <link href="css/mui.min.css" rel="stylesheet"/>
    <link rel="stylesheet" href="css/base.css" />
    <script src="js/flexible.js"></script>
    <link rel="stylesheet" href="css/chongzhimima.css" />
    <script src="js/jquery-3.1.1.js"></script>
    <script src="js/config.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
	<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title">重置密码</h1>
	</header>
	<form class="mui-input-group" style="margin-top: 44px;">
		<div class="mui-input-row">
			<label>手 机 号</label>
			<input type="text"  placeholder="请输入手机号" id="phone">
		</div>
		<div class="mui-input-row" >
			<label>验 证 码</label>
			<input type="text"  placeholder="请输入短信验证码" id="phoneCode">
			
		</div>
		<div class="mui-input-row">
			<label>密 码</label>
			<input type="password"  placeholder="请输入6-12位密码" id="password">
		</div>
		<div class="mui-input-row" >
			<label>确认密码</label>
			<input type="password"  placeholder="请再次输入密码" id="rpass">
			
		</div>
		
		
	</form>
	<div class="mui-content" style="background: none;padding-top: 0;margin-top: 1.5rem;">
		    <div class="mui-content-padded">
		        <button type="button" class="mui-btn mui-btn-primary mui-btn-block" id="btn" style="font-size: 0.4rem;">确认修改</button>
		    </div>
	</div>
	<script>
		$("#phone").blur(function() {
		    var phone = $('#phone').val();
		    // alert(phone);
		    var reg = /^1[3|4|5|8|7|9|6][0-9]\d{8}$/;
		    if (phone == "" || !reg.test(phone)) {
		        mui.toast("请正确填写手机号码");
		        return;
		    }
		})
		
		//获取手机号码和验证码
			var loc = location.href;
			var locArr = loc.split('='); //=号截取数据
			$('#phone').val(locArr[1]);
		$("#btn").on('tap',function(){
			var userPhone=$("#phone").val()
			var phoneCode=$("#phoneCode").val()
			var password=$("#password").val()
			var rpass=$("#rpass").val()			
			mui.ajax(config.host+'/home/Login/resetPass',{
				data:{
					 phone:userPhone,
					 pCode:phoneCode,
					 password:password,
					 rpass:rpass
				},
				dataType:'json',//服务器返回json格式数据
				type:'post',//HTTP请求类型	              
				success:function(data){
					if(data.code==200){
						mui.toast(data.msg)
						location.href='login.html'
					}else{
						mui.toast(data.msg)
					}
				}
			});
		})
	</script>
</body>
</html>

